package com.ruoyi.business.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.SecurityUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.TaskSurveyMapper;
import com.ruoyi.business.domain.TaskSurvey;
import com.ruoyi.business.service.ITaskSurveyService;

/**
 * 任务调研记录Service业务层处理
 * 
 * @author Eric
 * @date 2024-03-20
 */
@Slf4j
@RequiredArgsConstructor
@Service
public class TaskSurveyServiceImpl extends ServiceImpl<TaskSurveyMapper, TaskSurvey> implements ITaskSurveyService {

    @Override
    public TaskSurvey getByTaskIdAndPointId(Long taskId, Long pointId) {
        return this.getOne(Wrappers.lambdaQuery(TaskSurvey.class)
                .eq(TaskSurvey::getTaskId, taskId)
                .eq(TaskSurvey::getTaskPointId, pointId)
                .eq(TaskSurvey::getUserId, SecurityUtils.getUserId())
                .last(" LIMIT 1")
        );
    }
}
